package com.sl.au.repository;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.ReceivedPaymentDetailInfo;


public interface ReceivedPaymentDetailInfoRepository extends JpaRepository<ReceivedPaymentDetailInfo, String> {
	@Query("select c from ReceivedPaymentDetailInfo c where c.sReceivedPaymentTotalId.id=?1")
	List<ReceivedPaymentDetailInfo> findBysReceivedPaymentTotalId(String sReceivedPaymentTotalId);	
    	
	List<ReceivedPaymentDetailInfo> findBySContractId(String sContractId);
	
	@Query("select count(*) from ReceivedPaymentDetailInfo c where c.sReceivedPaymentTradeWay.title like %?1% or c.sReceivedPaymentMemo like %?1% ")
	long getCount(String key);
	
	@Query("select p.nReceivedPaymentDetailPrice from ReceivedPaymentDetailInfo p where p.sContractId = ?1")
    float[] getnReceivedPaymentDetailPrice(String contractId);
	
	@Query("select c from ReceivedPaymentDetailInfo c where c.sReceivedPaymentTradeWay.title like %?1% or c.sReceivedPaymentMemo like %?1% ")
	Page<ReceivedPaymentDetailInfo> getPage(String key, Pageable pageable);
	
	@Query("select c from ReceivedPaymentDetailInfo c")
	Page<ReceivedPaymentDetailInfo> getPage(Pageable pageable);
}
